let itemContainer = document.querySelector('#item-container')
let circles = document.querySelectorAll('.circle span')
let swiper = document.querySelector('.swipper')

var i = 0
const k = 5



function move() {
    if (i == 5) {
        i = 0
    }
    itemContainer.style.transform = `translateY(-${333 * i++}px)`
}

function goTo(index){
    itemContainer.style.transform = `translateY(-${333 * index}px)`
}
var timer;

//timer = setInterval(move,1000)

// swiper.onmouseenter = function () {
//     clearInterval(timer)
//     console.log('轮播图停止运动')
//     console.log(`清除定时器id：${timer}`)
// }

// swiper.onmouseleave = function(){   
//     timer = setInterval(move,1000)
//     console.log('轮播图开始运动')
//     console.log(`生成定时器id：${timer}`)
// }

circles.forEach(function(el){
    el.onmouseenter = function(){
        let index = el.dataset.index
        goTo(index)
    }
})